import axios from "axios";
import {getToken} from "@/utils/auth.ts";

export const baseURl = NetWorkJamesYao().base_url

function NetWorkJamesYao(){
    const base_url = 'http://127.0.0.1:8013'
    return {base_url}
}

const service = axios.create({
    baseURL:baseURl,
})

service.interceptors.request.use(
    (config)=>{
        const token = getToken();

        if (token){
            config.headers['Authorization'] = token
        }
        return config;
    },(error)=>{
        return Promise.reject(error)
    }
)

export default service
